<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<jsp:include page="../include/header.jsp" />
<jsp:include page="../include/navigation.jsp" />

<!-- <h2>My Collection</h2> -->

<div id="sideBar">
	<jsp:include page="inc_side.jsp" />
</div>
<div id="content">
	<div id="movieInfoTitle">
		<h2>${collectionItem.media.name}</h2>
	</div>
	
	<div id="movieInfoCover">
		<img class="cover" src="${baseUrl}/collection/cover/${collectionItem.media.id}" /><br/>
	</div>
	<div id="movieInfoOverview">
		<p>${collectionItem.media.overview}</p>
		<p><br/></p>
		<p>
			<strong>Releasedate:</strong> <fmt:formatDate value="${collectionItem.media.releasedDate}" pattern="dd/M/yyyy" /><br/>
			<strong>Mustsee:</strong> ${collectionItem.mustSee}<br/>
			<strong>Language(s):</strong> ${collectionItem.media.language}<br/>
			<strong>Rating:</strong> ${collectionItem.media.rating}<br/>
			<c:if test="${!empty collectionItem.media.imdbID}">
				<a target="_blank" href="http://www.imdb.com/title/${collectionItem.media.imdbID}">IMDB</a>
			</c:if>
			<br/><br/>
			<c:if test="${!empty collectionItem.suggestions}">
				<p><strong>suggested by </strong>
				<c:forEach items="${collectionItem.suggestions}" var="suggestion" varStatus="sugStat">
					<a href="${baseUrl}/friends/info/${suggestion.suggestedBy.id}">${suggestion.suggestedBy.fullName}</a>
					<c:choose>
						<c:when test="${sugStat.last}" />
						<c:when test="${sugStat.index == fn:length(collectionItem.suggestions)-2}"> and </c:when>
						<c:otherwise> , </c:otherwise>
					</c:choose>
				</c:forEach>
				</p>
			</c:if>
		</p>
	</div>
	<div class="clear"></div>
	<div id="movieControls">
		<p>
		<c:choose>
			<c:when test="${collectionItem.mustSee}">
				<a href="${baseUrl}/collection/mustnotsee/${collectionItem.id}">Remove from must-see</a><br/>
			</c:when>
			<c:otherwise>
				<a href="${baseUrl}/collection/mustsee/${collectionItem.id}">Add to must-see</a><br/>
			</c:otherwise>
		</c:choose>
		
		<a id="lnkRemindMe" rel="${collectionItem.id}" class="remindMeDialogOpen" href="${baseUrl}/collection/findreleasedate/${collectionItem.media.id}">Add a release-reminder</a><br/>
		<a id="lnkSendSuggestion" rel="${collectionItem.id}" class="friendsDialogOpen" href="${baseUrl}/collection/suggest/">Suggest this title to (a) friend(s)</a><br/>
		<a href="${baseUrl}/collection/remove/${collectionItem.media.id}">Remove from My Collection</a></p>
	</div>
</div>

<!-- Friendssialog -->
<div id="friendsDialog"></div>
<!-- RemindMeDialog -->
<div id="remindMeDialog"></div>

<jsp:include page="../include/footer.jsp" />